import nme.Assets;
import nme.display.Graphics;
import nme.display.Sprite;
import nme.display.Bitmap;
import nme.display.BitmapData;

import nme.geom.Rectangle;
import nme.geom.Matrix;
import nme.geom.Point;

import nme.events.Event;
import nme.events.MouseEvent;

class TestFrameAndAnim extends Sprite
{
	private var _sprite:SpriteData;
	private var _listAnim:Array<Animation>;
	private var _frame:Frame;
	private var _anim:Animation;
	
	public function new ()
	{
		super ();
		addEventListener (Event.ENTER_FRAME, onEnterFrame);
		
		var xml:Xml = Xml.parse(Assets.getText ("cricket.xml")).firstElement ();
		_sprite = SpriteData.create (xml);
		
		_frame = new Frame (_sprite, "2011");
		_frame.x = 100;
		_frame.y = 200;
		_frame.addEventListener(MouseEvent.CLICK, onclick);
		addChild(_frame);
		
		_anim = new Animation (_sprite, "3000");
		_anim.x = 400;
		_anim.y = 500;
		addChild(_anim);
	}		
	
	private function onclick (e:MouseEvent):Void
	{
	}
	
	private function onEnterFrame(event:Event):Void
	{
		_anim.update();
		_anim.render();
		_frame.render ();
	}
}